define(["jquery","template","as/app/gms/gms.servers","as/template/gms/gms.tpl"],function($,template,$servers,tpl){
	var ui = {};

	var drawParents = function(data){
		return template("gms_patients",data);
	}
	ui.patients = function(options){
		$("#" + options.id).html(tpl.patients());
		var h = drawParents(options);
		$("#" + options.id).html(h);
	}

	var drawInfo = function(data){
		return template("gms_info",data);
	}
	ui.info = function(options){
		$("#" + options.id).html(tpl.info());
		var h = drawInfo($servers.handleInfo(options.info));
		$("#" + options.id).html(h);
	}

	var drawResult = function(data){
		return template("gms_result",data);
	}
	ui.result = function(options){
		$("#" + options.id).html(tpl.result());
		var h = drawResult($servers.handleResult(options.info));
		$("#" + options.id).html(h);
	}

	return ui;
});